package com.zxq.ai.domain.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

@Getter
@AllArgsConstructor
public enum RewardStrategy {

    NO_REWARD("no_reward", "无奖励"),
    PAYMENT_REALTIME("payment_realtime", "满足条件立即发放"),
    PAYMENT_AT_END("payment_at_end", "活动结束后发放"),

    ;

    private final String code;
    private final String desc;


    public static RewardStrategy getByCode(String code) {
        if (Objects.isNull(code)) {
            return null;
        }

        for (RewardStrategy value : RewardStrategy.values()) {
            if (value.getCode().equals(code)) {
                return value;
            }
        }
        return null;
    }


}
